<!DOCTYPE html>
<html>
<head>
	<?php
require_once("../inc/constants.inc.php");
require_once("../inc/connection.php");
session_start();
?>
</head>
<body>
<?php
	if(isset($_POST['timeBtn']))
		{
			if(empty($_POST['testTime']))
				{
					$url="../manage-time.php?isEmpty=yes";
					header("Refresh:0;URL=$url");
					exit(0);
				}
			elseif(!is_numeric($_POST['testTime']))
				{
					$url="../manage-time.php?isNumeric=no";
					header("Refresh:0;URL=$url");
					exit(0);
				}
			else
				{
					$examTime = mysql_real_escape_string($_POST['testTime']);
					$typeId = $_POST['typeId'];
					$examTime = $examTime * 60 * 1000;
					$sql = "UPDATE `exam_config` SET examTime='$examTime' WHERE typeId='$typeId'";
					if(mysql_query($sql))
						{					
							$url="../manage-time.php?isUpdated=yes";
							header("Refresh:0;URL=$url");
						}
				}
		}
/*
	elseif(isset($_POST['technicalTimeBtn']))
		{
			if(empty($_POST['technicalText']))
				{
					$url="../manage-time.php?isEmpty=yes";
					header("Refresh:0;URL=$url");
					exit(0);
				}	
			elseif(!is_numeric($_POST['technicalText']))
				{
					$url="../manage-time.php?isNumeric=no&type=technical";
					header("Refresh:0;URL=$url");
					exit(0);
				}
			else
				{				
					$examTime = mysql_real_escape_string($_POST['technicalText']);
					$examTime = $examTime * 60 * 1000;
					$sql = "UPDATE `exam_config` SET examTime='$examTime' WHERE typeId=2";
					if(mysql_query($sql))
						{					
							$url="../manage-time.php?isUpdated=yes&type=technical";
							header("Refresh:0;URL=$url");
						}
				}
		}	
*/		
?>
</body>
</html>